import {BasicColumn, FormSchema} from '/@/components/Table';
import {DescItem} from '/@/components/Description/index';

export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    width: 20,
    ifShow: false
  },

  {
    title: '服务编码',
    dataIndex: 'serviceCode',
    helpMessage: '网关请求服务地址的第一段名称, 比如 /system-service/dict/listDict 接口对应的服务编码就是 system-service',
    width: 150,
  },

  {
    title: '模块名称',
    dataIndex: 'name',
    width: 150,
  },

  {
    title: '模块编码',
    dataIndex: 'code',
    width: 150
  },

  {
    title: '创建时间',
    dataIndex: 'createdAt',
    sorter: true,
    width: 150,
  },
  {
    title: '更新时间',
    dataIndex: 'updatedAt',
    sorter: true,
    width: 150
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'code',
    label: '模块编码',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'name',
    label: '模块名称',
    component: 'Input',
    colProps: { span: 8 },
  }
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    required: false
  },
  {
    label: '服务编码',
    field: 'serviceCode',
    component: 'Input',
    helpMessage: '这里指的是服务url的一级路径',
    required: true
  },
  {
    field: 'code',
    label: '模块编码',
    component: 'Input',
    required: true,
    dynamicDisabled: ({values}) => {
      return !!values.id;
    },
  },
  {
    label: '模块名称',
    field: 'name',
    component: 'Input',
    required: true
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请输入备注',
      rows: 5,
    },
  }
];



export const formDetailSchema : DescItem[] = [
  {
    field: 'serviceCode',
    label: '服务编码',
  },
  {
    field: 'name',
    label: '模块名称',
  },
  {
    field: 'code',
    label: '模块编码'
  },
  
  {
    field: 'createdAt',
    label: '创建时间'
  },

  {
    field: 'updatedAt',
    label: '更新时间'
  },

  {
    label: '备注',
    labelMinWidth: 60,
    field: 'remark',
  }
];
